#include"pbar.h"
#include<unistd.h>
typedef void (*callback_t)(int);

void downLoad(callback_t cb)
{
	int total=1000;
	int cur=0;
	while(cur<=total)
	{
		usleep(50000);
		int rate=cur*100/total;
		cb(rate);
		cur+=10;
	}
	printf("\n");
}

int main()
{
    printf("donwnload 1: \n");
    downLoad(pbar);
    initbar();
    printf("donwnload 2: \n");
    downLoad(pbar);
    initbar();
    printf("donwnload 3: \n");
    downLoad(pbar);
    initbar();
    printf("donwnload 4: \n");
    downLoad(pbar);
    initbar();



   // fflush(stdout);
   // sleep(2);              // 2
    return 0;
}

